package Utility;

/**
 * Represents the identity and status of the users on the client side of the
 * chat program.
 * 
 * @author Leenix
 */
class User {

	private String username;
	private boolean online;

	/**
	 * User Constructor - User Create a new user for a ChatServer
	 * database/arrayList entry.
	 * 
	 * @param name
	 *            The name of the user to be added.
	 */
	public User(String name) {
		this.username = name;
		this.online = false;
	}

	/**
	 * getUsername Getter - User.username
	 * 
	 * @return The name of the user.
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * loggedIn Getter = User.online
	 * 
	 * @return Whether or not the user is currently logged in to the server.
	 */
	public boolean loggedIn() {
		return this.online;
	}

	/**
	 * login Setter - User.online Set the user's online status to true.
	 */
	public void login() {
		this.online = true;
	}

	/**
	 * logout Setter - User.online Set the user's online status to false.
	 */
	public void logout() {
		this.online = false;
	}

	/**
	 * Associate the User object's output to its username.
	 */
	public String toString() {
		return username;

	}
}
